package com.gitee.center.test;

import com.gitee.center.runtime.OrderModelCreator;
import com.sun.istack.internal.NotNull;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;

@Getter // 注意：它没有@Setter，是为了封装，包含订单一致性
@Slf4j
public class OrderMain implements IOrderMain{
    private Long id;

    private String source;
    private String customerNo;

    private String orderNo;

    private String externalNo;
    public static OrderMain createWith(@NotNull OrderModelCreator creator){
        log.debug("creating with {}", creator);
        return new OrderMain(creator);
    }

    private OrderMain(OrderModelCreator creator) {
        this.id = 111L;
        this.source = creator.getSource();
        this.customerNo = creator.getCustomerNo();
        this.externalNo = creator.getExternalNo();

    }

}
